<?php
/**
 * Created by PhpStorm.
 * User: extraxue
 * Date: 2018/5/7
 * Time: 上午1:14
 */
session_start();
date_default_timezone_set('PRC');
require_once ('pdo.php');
$newNewsTitle = $_POST['newNewsTitle'];
$newNewsAuthor = $_POST['newNewsAuthor'];
$newNewsType = $_POST['newNewsType'];
$newNewsContent = $_POST['field2'];
$uid = $_SESSION['uid'];
$now_date = date('Y-m-d H:i:s');


try {
    $sqlNewsChange = "update news_info a set a.news_title='{$newNewsTitle}',
a.news_author='{$newNewsAuthor}',a.news_type='{$newNewsType}',a.news_content='{$newNewsContent}',a.change_time='{$now_date}'
where a.uid='$_SESSION[uid]'";
    $pdo->exec($sqlNewsChange);
    echo "<script>alert('修改成功！');history.back()</script>";
} catch (Exception $e){
    echo "<script>alert('修改异常！');history.back()</script>";
}

